Skip to content

Conversation

@jkelley129
Copy link

@jkelley129 jkelley129 commented Dec 12, 2025

This PR updates the rustc.1 manpage to reflect that the -O flag is equivalent to -C opt-level=3 (matching rustc --help). It also adds a maintenance script to keep this documentation in sync with the compiler.

Documentation

  • Updated the description of -O in rustc.1 to state that it corresponds to -C opt-level=3.

Tooling

Added a new script: src/tools/update-rustc-man-opt-level.py, which:

  • Extracts the -Oopt-level mapping from rustc --help (or a provided expected level).
  • Updates the manpage accordingly, with a conservative heuristic to avoid unrelated rewrites.
  • Supports dry-run by default and optional apply mode with automatic backups.
  • Displays colored unified diffs for review.
  • Allows specifying a custom rustc binary.

Fixes: #149875

Copilot AI review requested due to automatic review settings December 12, 2025 04:40
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 12, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 12, 2025

r? @GuillaumeGomez

rustbot has assigned @GuillaumeGomez.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

This comment was marked as spam.

@rust-log-analyzer
Copy link
Collaborator

The job tidy failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
fmt: checked 6589 files
tidy check
tidy [rustdoc_json (src)]: `rustdoc-json-types` modified, checking format version
tidy: Skipping binary file check, read-only filesystem
tidy [style (src)]: /checkout/src/tools/update-rustc-man-opt-level.py:58: line longer than 100 chars
tidy [style (src)]: /checkout/src/tools/update-rustc-man-opt-level.py:119: line longer than 100 chars
tidy [style (src)]: /checkout/src/tools/update-rustc-man-opt-level.py:142: line longer than 100 chars
tidy [style (src)]: /checkout/src/tools/update-rustc-man-opt-level.py:143: line longer than 100 chars
tidy [style (src)]: /checkout/src/tools/update-rustc-man-opt-level.py:144: line longer than 100 chars
tidy [style (src)]: /checkout/src/tools/update-rustc-man-opt-level.py:145: line longer than 100 chars
tidy [style (src)]: /checkout/src/tools/update-rustc-man-opt-level.py:146: line longer than 100 chars
tidy [style (src)]: /checkout/src/tools/update-rustc-man-opt-level.py:161: line longer than 100 chars
tidy [style (src)]: /checkout/src/tools/update-rustc-man-opt-level.py:175: line longer than 100 chars
tidy [style (src)]: /checkout/src/tools/update-rustc-man-opt-level.py:186: line longer than 100 chars
tidy [style (src)]: FAIL
removing old virtual environment
creating virtual environment at '/checkout/obj/build/venv' using 'python3.10' and 'venv'
creating virtual environment at '/checkout/obj/build/venv' using 'python3.10' and 'virtualenv'
Requirement already satisfied: pip in ./build/venv/lib/python3.10/site-packages (25.3)
linting python files
/checkout/src/tools/update-rustc-man-opt-level.py:50:9: B904 Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
Found 1 error.

python linting failed! Printing diff suggestions:
tidy [extra_checks]: checks with external tool 'ruff' failed
tidy [extra_checks]: FAIL
tidy: The following checks failed: extra_checks, style (src)
Bootstrap failed while executing `test src/tools/tidy tidyselftest --extra-checks=py,cpp,js,spellcheck`
Command `/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools-bin/rust-tidy /checkout /checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo /checkout/obj/build 4 /node/bin/yarn --extra-checks=py,cpp,js,spellcheck` failed with exit code 1
Created at: src/bootstrap/src/core/build_steps/tool.rs:1612:23
Executed at: src/bootstrap/src/core/build_steps/test.rs:1320:29

Command has failed. Rerun with -v to see more details.
Build completed unsuccessfully in 0:01:20
  local time: Fri Dec 12 04:45:10 UTC 2025
  network time: Fri, 12 Dec 2025 04:45:10 GMT
##[error]Process completed with exit code 1.
##[group]Run echo "disk usage:"

@jkelley129 jkelley129 marked this pull request as draft December 12, 2025 04:55
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 12, 2025
@bjorn3
Copy link
Member

bjorn3 commented Dec 12, 2025

Would you mind disabling the option in your user profile to automatically request copilot reviews?

@GuillaumeGomez
Copy link
Member

r? compiler

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Dec 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rustc man page does not match rustc --help output

6 participants